---
title: "Reference: Mastra.getVector() | Core"
description: "Documentation for the `Mastra.getVector()` method in Mastra, which retrieves a vector store by name."
---

# Mastra.getVector()

The `.getVector()` method is used to retrieve a vector store by its name. The method accepts a single `string` parameter for the vector store's name.

## Usage example

```typescript copy
mastra.getVector("testVectorStore");
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "name",
      type: "TVectorName extends keyof TVectors",
      description:
        "The name of the vector store to retrieve. Must be a valid vector store name that exists in the Mastra configuration.",
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "vector",
      type: "TVectors[TVectorName]",
      description:
        "The vector store instance with the specified name. Throws an error if the vector store is not found.",
    },
  ]}
/>

## Related

- [Vector stores overview](/docs/v1/rag/vector-databases)
- [RAG overview](/docs/v1/rag/overview)
